]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/volume: Unmute to default volume when at 0
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 13 Feb 2023 22:48:39 +0000 (23:48 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 14 Feb 2023 21:28:44 +0000 (21:28 +0000)
The stream can be muted by clicking the icon, or by dragging the
slider to 0. In the latter case, clicking the icon to unmute the
stream will not do anything (at least apparently).

Settings addresses this in its Sound panel by using a default
volume of 25% in that case, so do the same in the Shell.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6393

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2644>

js/ui/status/volume.js

index 078805c3e40601739c52b7ffd4ab417fdf4d1f98..fd6c8e7d6ab0d3e5af4ccc39c81553516b82428f 100644 (file)
@@ -9,6 +9,7 @@ const PopupMenu = imports.ui.popupMenu;
 const {QuickSlider, SystemIndicator} = imports.ui.quickSettings;
 
 const ALLOW_AMPLIFIED_VOLUME_KEY = 'allow-volume-above-100-percent';
+const UNMUTE_DEFAULT_VOLUME = 0.25;
 
 // Each Gvc.MixerControl is a connection to PulseAudio,
 // so it's better to make it a singleton
@@ -60,7 +61,13 @@ const StreamSlider = GObject.registerClass({
             if (!this._stream)
                 return;
 
-            this._stream.change_is_muted(!this._stream.is_muted);
+            const {isMuted} = this._stream;
+            if (isMuted && this._stream.volume === 0) {
+                this._stream.volume =
+                    UNMUTE_DEFAULT_VOLUME * this._control.get_vol_max_norm();
+                this._stream.push_volume();
+            }
+            this._stream.change_is_muted(!isMuted);
         });
 
         this._deviceItems = new Map();